home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 14074 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.8 KB  |  64 lines

  1. Path: news3.digex.net!usenet
  2. From: bablank@access.digex.net (Bruce Blank)
  3. Newsgroups: comp.lang.c++
  4. Subject: HELP! How Do I Get A Long File Name From Short Name?
  5. Date: 29 Mar 1996 01:57:51 GMT
  6. Organization: Express Access Online Communications, USA
  7. Message-ID: <4jfg2v$e1c@news3.digex.net>
  8. NNTP-Posting-Host: dcd00222.slip.digex.net
  9. Mime-Version: 1.0
  10. X-Newsreader: WinVN 0.99.2
  11.  
  12. Hello All,
  13.  
  14.      I'm trying to get a long file name from a short file name. I've tried 
  15. using GetFullPathName but couldn't get it to work. An extract from my 
  16. program is included below. What I really want to do is convert a short 
  17. path name to a long path name such as:
  18.    
  19.       "c:\windows\startm~1\progra~1\window~1.lnk" 
  20.    
  21.                       to
  22.  
  23.       "c:\windows\Start Menu\Programs\Windows Explorer.lnk"
  24.  
  25. Can anyone suggest the best (or any) way to do this. I'm new to
  26. Windows 95 and Visual C++ 4.0 (and not exactly a C++ guru yet) and not 
  27. sure how this long file name business is handled programatically. Thanks 
  28. in advance for your help.
  29.  
  30. Regards... Bruce Blank
  31.  
  32. ====================================================================
  33.  
  34. HRESULT GetLinkInfo(HWND hWnd, char *lpszLinkName, char *pszOutName)
  35.  
  36. {
  37.    .
  38.    .
  39.    .
  40.    char szLongFileName[128];
  41.    char * lpszLongFileName;
  42.    lpszLongFileName = szLongFileName;
  43.    .
  44.    .
  45.    .
  46.    GetFullPathName(lpszLinkName, MAX_PATH, szLongFileName,                
  47.                    &lpszLongFileName);
  48.    .
  49.    .
  50.    .
  51.    (then try to write result to file which still reflects short name!)
  52.    .
  53.    .
  54. }
  55.  
  56. - - 
  57. ======================================================
  58. * Bruce Arlan Blank                                  *
  59. * -------------------------------------------------- *
  60. * email: bablank@access.digex.net                    *
  61. * WWW page: http://www.access.digex.net:80/~bablank/ *
  62. ======================================================
  63.  
  64.